﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="save" Then
	call savea
else
	call index
end if 
end Function
Function index
	dim rs,sql,Runtxt,str
	Runtxt=qingtian.RunStr
	dim pid,id
    		pid = Request("pid")    
    		If pid = "" Then pid = 0
   		If Not IsNumeric(pid) Then pid = 0
    		pid = CLng(pid)
    		If pid < 0 Then pid = 0
    		id = Request("id")    
    		If id = "" Then id = 0
   		If Not IsNumeric(id) Then id = 0
    		id = CLng(id)
dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select * from qingtian_showclass where id="&id&" order by [id] asc"
Rs.Open Sql,conn,1,1
if not (rs.bof and rs.eof)  then
%>
	<card title="添加栏目"><p align="left">

	栏目名称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>" maxlength="50" value="<%=rs("name")%>" type="text"/><br/>
	栏目排序：<br/>
	<input emptyok="true"  name="nid<%=Runtxt%>" format="*N" value="<%=rs("nid")%>" type="text"/><br/>
	栏目内容：<br/>
	<input emptyok="true"  name="content<%=Runtxt%>"  value="<%=rs("content")%>" type="text"/><br/>
	<anchor>确定提交
    	<go href="editcavet.asp?Action=save&amp;page=<%=page%>&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="nid" value="$(nid<%=Runtxt%>)"/>
        <postfield name="content" value="$(content<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>
<a href='cavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>'>返回栏目管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end if
rs.Close
Set rs = Nothing
end Function 



Function savea
dim pid,id,name,content,nid,errs,rsa,spla,page
	        pid=Request.QueryString("pid")
	        if pid="" then pid=0
	        if not isnumeric(pid) then pid=0
	        pid=clng(pid)
	        id=Request.QueryString("id")
	        if id="" then id=0
	        if not isnumeric(id) then id=0
	        id=clng(id)
    		Page = Request.QueryString("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
		name=Request.form("name")
		nid=Request.form("nid")
		content=Request.form("content")
		errs=""
		if name="" then errs=errs & "栏目名称不能为空<br/>"
		if nid="" then errs=errs & "栏目排序不能为空<br/>"
		if content="" then errs=errs & "栏目内容不能为空<br/>"
	IF len(errs)=0 then
	conn.execute("update qingtian_showclass set name='"&name&"',pid="&pid&",content='"&content&"',nid="&nid&" where id="&id&"")

	%>
<card title="修改栏目"><p align="left">
		添加栏目成功!<br/><%
	else%>
	<card title="修改栏目"><p align="left">
		<%=errs%><%=name%><%=content%><%=nid%>
		<a href="editcavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='editcavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sid%>'>返回添加栏目</a><br/>
<a href='cavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>'>返回栏目管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function
%>
